//
//  ViewController.swift
//  UITableViewDemo
//
//  Created by daqsoft-mac on 2022/5/11.
//

import UIKit

class ViewController: MCTableViewBaseViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.
        configView1()
        configView2()
        
        self.tableView.backgroundColor = UIColor.lightGray
        self.tableView.register(UINib.init(nibName: "MCTestCell", bundle: nil), forCellReuseIdentifier: MCTestCell.identifierString())
        self.tableView.register(TestHeaderFooterView.self, forHeaderFooterViewReuseIdentifier: TestHeaderFooterView.identifierString())
        self.tableView.reloadData()
        self.navigationController?.setNavigationBarHidden(false, animated: true)
    }
    
    func configHeader() {
        
        
    }

    func configView1() {
        
        let sectionOne = MCPublicTableViewSectionModel.init(sort: 1)
        sectionOne.sort = 1
        let header1 = MCPublicTableViewSectionHeaderFooterViewModel()
        header1.identifier = TestHeaderFooterView.identifierString()
        header1.height = 30
        sectionOne.sectionHeaderProtocol = header1
        let cellModel = MCPublicTableViewCellModel()
        cellModel.identifier = MCTestCell.identifierString()
        cellModel.sorting = 2
        cellModel.height = 50
        cellModel.otherData = "另外的测试文本1"
        sectionOne.addSectionCellModel(cellModel)
        let cellModel1 = MCPublicTableViewCellModel()
        cellModel1.identifier = MCTestCell.identifierString()
        cellModel1.sorting = 1
        cellModel1.height = 50
        cellModel1.otherData = "另外的测试文本2"
        sectionOne.addSectionCellModel(cellModel1)
        let cellModel2 = MCPublicTableViewCellModel()
        cellModel2.identifier = MCTestCell.identifierString()
        cellModel2.sorting = 3
        cellModel2.height = 50
        cellModel2.otherData = "另外的测试文本3"
        sectionOne.addSectionCellModel(cellModel2)
        let cellModel3 = MCPublicTableViewCellModel()
        cellModel3.identifier = MCTestCell.identifierString()
        cellModel3.sorting = 4
        cellModel3.height = 50
        cellModel3.otherData = "另外的测试文本4"
        sectionOne.addSectionCellModel(cellModel3)
        self.addSectionModel(sectionOne)
    }
    
    func configView2() {
        let sectionOne = MCPublicTableViewSectionModel()
        sectionOne.sort = 0
        
        let header1 = MCPublicTableViewSectionHeaderFooterViewModel()
        header1.identifier = TestHeaderFooterView.identifierString()
        header1.height = 80
        sectionOne.sectionHeaderProtocol = header1
        let cellModel = MCPublicTableViewCellModel()
        cellModel.identifier = MCTestCell.identifierString()
        cellModel.sorting = 2
        cellModel.height = 50
        cellModel.otherData = "另外的测试文本11"
        sectionOne.addSectionCellModel(cellModel)
        let cellModel1 = MCPublicTableViewCellModel()
        cellModel1.identifier = MCTestCell.identifierString()
        cellModel1.sorting = 1
        cellModel1.height = 50
        cellModel1.otherData = "另外的测试文本12"
        sectionOne.addSectionCellModel(cellModel1)
        let cellModel2 = MCPublicTableViewCellModel()
        cellModel2.identifier = MCTestCell.identifierString()
        cellModel2.sorting = 3
        cellModel2.height = 50
        cellModel2.otherData = "另外的测试文本13"
        sectionOne.addSectionCellModel(cellModel2)
        let cellModel3 = MCPublicTableViewCellModel()
        cellModel3.identifier = MCTestCell.identifierString()
        cellModel3.sorting = 4
        cellModel3.height = 50
        cellModel3.otherData = "另外的测试文本14"
        sectionOne.addSectionCellModel(cellModel3)
        self.addSectionModel(sectionOne)
    }
}

